define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'company/index',
        add_url: 'company/add',
        edit_url: 'company/edit',
        delete_url: 'company/delete',
        export_url: 'company/export',
        modify_url: 'company/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh',
                    [
                        {
                                text: '添加',
                                url: init.add_url,
                                method: 'open',
                                auth: 'add',
                                class: 'layui-btn layui-btn-normal layui-btn-sm',
                                icon: 'fa fa-plus ',
                            }
                        ],
                    ],
                cols: [[
                    {field: 'cur_type',  title: '类型',selectList: {0:" ",1: '个人',2: '企业'}},
                    {field: 'company_name', title: '公司名称'},
                    {field: 'business_license_photo',  title: '营业执照', search: false, templet: ea.table.image},
                    {field: 'company_logo',  title: '公司logo', search: false, templet: ea.table.image}, 
                    {field: 'contact_person_name', title: '联系人姓名'},
                    {field: 'contact_person_avatar',  title: '联系人头像', search: false, templet: ea.table.image}, 
                    {field: 'mobile', title: '注册账号'},
                    {field: 'is_lock',title: '状态',selectList: {0: '待审核',1: '正常',2:'拒绝'}},
                    {field: 'identity_card_front', title: '身份证正面', search: false, templet: ea.table.image}, 
                    {field: 'identity_card_back',  title: '身份证反面', search: false, templet: ea.table.image}, 
                    {field: 'created_at', title: '添加时间', search: false},
                    {width: 250, title: '操作', templet: ea.table.tool},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});